# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pyu2f
pkgver=0.1.5
pkgrel=5
pkgdesc="U2F host library for interacting with a U2F device over USB"
url="https://github.com/google/pyu2f"
license=('Apache')
arch=('any')
depends=('python-six')
makedepends=('python-setuptools')
checkdepends=('python-mock' 'python-pyfakefs' 'python-pytest')
source=("https://github.com/google/pyu2f/archive/$pkgver/$pkgname-$pkgver.tar.gz" "pyfakefs-compat.patch")
sha512sums=('ddb15bb1d917117a2b19ad169ac0f8b8c7667d7ef8ee4c266cc30326429bb3627d41d84dc390ce0036d0b0f110e1d2da47d06d4e4d03a8be98cedb5ea3112246'
            'ef12d29114292918d5820ff129cfcfa820637464e1945252c5fca80be40cfb8d5df5d57efc8dac748d1b952acca177c953a69a3a16d096c92bd8a61687b80fe0')

prepare() {
  cd pyu2f-$pkgver
  patch -Np1 -i ${srcdir}/pyfakefs-compat.patch
}

build() {
  cd pyu2f-$pkgver
  python setup.py build
}

check() {
  cd pyu2f-$pkgver
  pytest
}

package() {
  cd pyu2f-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
}
